<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>
<html>
<head>
<title>대우조선해양</title>
<script type="text/javascript" src="${ctx }/js/jquery-1.7.1.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="${ctx }/js/jquery.dsme.js" charset="UTF-8"></script>

<script type="text/javascript">
	$(document).ready(function() {
	});
	
	function check(dong1){
		if($("#dong").val().length>=2){
			return true;
		}else{
			alert('2글자 이상이어야 합니다.');
			return false;
		}
	}
	
	function setDong(zip, sido, gugun, dong, bunji){
		var obj = {};
		obj.zip=zip;
		obj.sido=sido;
		obj.gugun=gugun;
		obj.dong=dong;
		obj.bunji=bunji;
		<c:if test="${!empty param.returnFunc && ''!=param.returnFunc}">
		opener.returnZip(obj);
		self.close(); 
		</c:if>
		
	}
	
	function chkSubmit(){
		if($("#dong").val().length>=2){
			$("#frmSearch").submit();
		}else{
			alert('2글자 이상이어야 합니다.');
		}
	}
	
</script>

</head>

<body>
	<div id="popup">
		<div class="header">
			<h2>우편번호 검색</h2>
			<a href="#" onclick="self.close();" class="close"></a>
		</div>
		<div class="content">
		<form action="" method="get" onsubmit="return check(this);" id="frmSearch">
			<input name="returnFunc" value="${param.returnFunc }" type="hidden"/>
			<div class="post">
				<label for="">지역명 </label><input type="text" name="dong" id="dong" value="${param.dong }"
					class="input" /> <a href="#" onclick="chkSubmit();" class="btn_b"><span>검색</span></a> <span
					class="ml20">예) 역삼동,화도읍,장유면 </span>
			</div>
		</form>
			<div>검색 결과 중 해당주소를 클릭하시면 자동 입력됩니다.</div>
			
			<div class="busiTable" style="margin-top: 10px">
				<table summary="">
					<tr>
						<th scope="col" class="first" style="width: 150px;">우편번호</th>
						<th scope="col">주소</th>

					</tr>
				</table>
			</div>
			
			<div class="busiTable01" style="height: 210px;">
				<table summary="">
					<tbody>
	<c:if test="${list !=null && fn:length(list)>0 }">
		<c:forEach var="map" items="${list}" varStatus="status">
						<tr>
							<td class="first" style="width: 150px;"><a href="#" onclick="setDong('${map.zipcode }','${map.sido }','${map.gugun }','${map.dong }','${map.bunji }');">${map.zipcode }</a></td>
							<td style="text-align: left;padding-left: 30px"><a href="#" onclick="setDong('${map.zipcode }','${map.sido }','${map.gugun }','${map.dong }','${map.bunji }');">${map.sido } ${map.gugun } ${map.dong } ${map.bunji }</a></td>
						</tr>
		</c:forEach>
	</c:if>
					</tbody>
				</table>
			</div>
		</div>
	</div>
</body>
</html>



